home *** CD-ROM | disk | FTP | other *** search
- package javax.swing.text.html;
-
- import javax.swing.text.AttributeSet;
- import javax.swing.text.html.HTML.Attribute;
-
- class Map$CircleRegionContainment implements Map.RegionContainment {
- // $FF: renamed from: x int
- int field_0;
- // $FF: renamed from: y int
- int field_1;
- int radiusSquared;
- float[] percentValues;
- int lastWidth;
- int lastHeight;
-
- public Map$CircleRegionContainment(AttributeSet var1) {
- int[] var2 = Map.extractCoords(var1.getAttribute(Attribute.COORDS));
- if (var2 != null && var2.length == 3) {
- this.field_0 = var2[0];
- this.field_1 = var2[1];
- this.radiusSquared = var2[2] * var2[2];
- if (var2[0] >= 0 && var2[1] >= 0 && var2[2] >= 0) {
- this.percentValues = null;
- } else {
- this.lastWidth = this.lastHeight = -1;
- this.percentValues = new float[3];
-
- for(int var3 = 0; var3 < 3; ++var3) {
- if (var2[var3] < 0) {
- this.percentValues[var3] = (float)var2[var3] / -100.0F;
- } else {
- this.percentValues[var3] = -1.0F;
- }
- }
- }
-
- } else {
- throw new RuntimeException("Unable to parse circular area");
- }
- }
-
- public boolean contains(int var1, int var2, int var3, int var4) {
- if (this.percentValues != null && (this.lastWidth != var3 || this.lastHeight != var4)) {
- int var5 = Math.min(var3, var4) / 2;
- this.lastWidth = var3;
- this.lastHeight = var4;
- if (this.percentValues[0] != -1.0F) {
- this.field_0 = (int)(this.percentValues[0] * (float)var3);
- }
-
- if (this.percentValues[1] != -1.0F) {
- this.field_1 = (int)(this.percentValues[1] * (float)var4);
- }
-
- if (this.percentValues[2] != -1.0F) {
- this.radiusSquared = (int)(this.percentValues[2] * (float)Math.min(var3, var4));
- this.radiusSquared *= this.radiusSquared;
- }
- }
-
- return (var1 - this.field_0) * (var1 - this.field_0) + (var2 - this.field_1) * (var2 - this.field_1) <= this.radiusSquared;
- }
- }
-